class Solution {
public:
    int longestPalindrome(string s) {
        unordered_map<char, int> count;
        for (auto x : s)
            count[x]++;

        int ret = 0;
        for (auto x : count)
            ret += (x.second / 2 * 2);

        return ret == s.size() ? ret : ret + 1;
    }
};